<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class InsertArticleRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
         return [
            //定义规则
            'goods_name' => 'required|max:80',
            'price' => 'required|numeric|min:0.1',
            'content' => 'required|max:255',
        ];
    }
	public function messages()
    {
        return [
            //错误信息
            'goods_name.required' => '商品名称不能为空',
            'goods_name.max' => '商品名称太长',
            'price.required' => '商品价格不能为空',
            'price.numeric' => '请输入正确的商品价格格式',
            'price.min' => '商品价格不得小于0.1',
            'content.required' => '商品详情不能为空',
            'content.max' => '商品详情内容太长',
        ];
    }
}
